package demo17_SinglePattern;

/**
 * @author kunkun
 * @className Test01_Hungry
 * @Description 单例模式---饿汉式
 * @date 2025/3/8 13:12
 */
public class Test01_Hungry {

    private static Test01_Hungry hungry = new Test01_Hungry();

    public static Test01_Hungry getInstance(){
        return hungry;
    }

    public static void main(String[] args) {
        Test01_Hungry instance1 = Test01_Hungry.getInstance();
        Test01_Hungry instance2 = Test01_Hungry.getInstance();
        System.out.println(instance1==instance2);   //true
    }
}
